/**	\file 
*	\addtogroup Wally
*	\{
*/
#ifndef __Wally_h__
#define __Wally_h__

// Predefined pins
#define IRpin		A0	///< analog pin A0 for reading the IR sensor (ORANGE)
#define LSpin		A1	///< analog pin A1 for reading the line scanner sensor
						// A4 reserved for I2C communication
						// A5 reserved for I2C communication
#define xbeeRX	 	 2	///< digital pin 2 for Xbee UART receive
#define xbeeTX	 	 3	///< digital pin 3 for Xbee UART transmit
#define movementPin	 5	///< digital pin 5 for reading the the movement sensor (XXXX WHITE?)
#define PINGpin		 7	///< digital pin 7 for reading the PING))) sensor (YELLOW)
#define soundPin	 8	///< digital pin 4 for reading the sound impact sensor (GRAY)
#define servoPin	 9	///< digital pin 9 for controlling servo position (PURPLE)
#define LSclockPin	10	///< digital pin 10 for controlling the line scanner clock signal (XXXXXXX)
#define LSsyncPin	11	///< digital pin 11 for controlling the line scanner sync signal (XXXXXXX)
#define laserPin	13	///< digital pin 13 to turn on/off laser (BROWN)

#define sensorPING	 0	///< numerical representation of the PING))) sensor from Parallax
#define sensorIR	 1	///< numerical representation of the IR distance sensor from Sharp 

// Defines for the Modelcraft MC-L560 DMG large server
//#define	servoMIN 800		///< Min PWM for servo at angle 0
//#define servoMAX 2700 		///< Max PWM for servo at angle 360 (I think)
#define servoMaxAngle 160	///< Max servo angle (physical limitation at about 178)
// Function definitions
/** 
*	\brief Perform a full servo rotation sensor sweep
*	Can perform either an initial sweep to build up template array of distances,
*	or run a normal sweep comparing those distances to the template
*	A movement is defined as a deviation on *both* sensors at the same angle, which
*	typically means we ignore the wider beam and thus earlier reports of the PING)))
*	until the Sharp IR can confirm the find.
*	\param uint8_t startAngle The starting angle of the sensor sweep, normally 0
*	\param uint8_t endAngle The ending angle of the sensors sweep, normally servoMaxAngle
*	\param uint8_t mode Scan mode, (r)eference, (s)can or (m)ovement 
*	\return 0==Nothing found, 1==Targe aqcuired
*   \note One weakness: if outside of the range of the Sharp we always report negative, as the PING is not alone to trigger a movement alert
*/	
uint8_t sensorSweep(uint8_t, uint8_t, uint8_t);

/** 
*	\brief Read sensor and report back distance.
*	\param sensor Number of the sensor to query distance from 
*	\return distance Distance measured by sensor (capped at sensor max range)
*/
uint16_t readSensor(uint8_t );



#endif /* __Wally_h__ */

/// \}
